# -*- coding:utf-8 -*-
import json
import sys
import os

import re
import redis
import web
from mymodule.config import *
from mymodule.serverrun import serverrun

reload(sys)
sys.setdefaultencoding('utf-8')
urls = (
    '/force_stop','force_stop',
)
abspath = os.path.dirname(__file__)
class force_stop:
    def GET(self):
        web.header('Access-Control-Allow-Origin', '*')
        r=getrdc()
        jincheng = r.llen('process')
        print jincheng
        if jincheng:
            for i in range(jincheng):
                n = r.rpop('process')
                os.system('kill -s 9 ' + n)
        return 'stop ok'

if __name__ == "__main__":
    app = web.application(urls, globals())
    app.run()